package org.dreamwork.jasmine2.sample.page;

import org.dreamwork.jasmine2.events.EventException;
import org.dreamwork.jasmine2.sample.data.Product;
import org.dreamwork.jasmine2.sample.util.Const;
import org.dreamwork.jasmine2.web.controls.Page;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: seth.yang
 * Date: 2010-10-26
 * Time: 14:12:26
 */
public class ProductPDFPage extends Page {
    protected List<Product> data;

    @Override
    @SuppressWarnings ("unchecked")
    public void onPageLoadCompleted (Page page) throws EventException {
        HttpSession session = context.getSession ();
        data = (List<Product>) session.getAttribute (Const.PRODUCT_LIST_DATA);
        if (data != null) {
            try {
                dataBind ();
            } catch (Throwable throwable) {
                throw new EventException (throwable);
            }
        }
    }
}